home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 36
/
Amiga Format CD36 (1999-01-22)(Future Publishing)(GB)[!][issue 1999-02].iso
/
-in_the_mag-
/
under_the_bonnet
/
multiscan_fixes
/
promoteview
/
promoteview.asm
< prev
next >
Wrap
Assembly Source File
|
1998-12-05
|
4KB
|
213 lines
******************
* PromoteView V2 *
* (C) 7-Jun-96 *
* Martin Gierich *
******************
;--------------------------------------------------------------
INCDIR Source:StripInc/
INCLUDE exec/exec_lib.i
INCLUDE dos/dos_lib.i
INCLUDE graphics/graphics_lib.i
INCLUDE graphics/view.i
INCLUDE graphics/monitor.i
CALL MACRO
jsr _LVO\1(a6)
ENDM
pr_CLI = 172
pr_MsgPort = 92
pr_CurrentDir = 152
cli_Module = 60
sm_NumArgs = 28
sm_ArgList = 36
;--------------------------------------------------------------
start: clr.l -(sp)
clr.l -(sp)
move.l 4.w,d6
move.l d6,a6
lea dosname(pc),a1
moveq #36,d0 check for OS2.0+
CALL OpenLibrary open dos.library
move.l d0,d5 d5=dos-base
beq NoDos
lea gfxname(pc),a1
moveq #36,d0
CALL OpenLibrary
move.l d0,d7 d7=graphics.library
beq NoGfx
move.l d5,a6 started from CLI
lea Template(pc),a0
move.l a0,d1
move.l sp,d2 a2=arg-array
moveq #0,d3
CALL ReadArgs process argumentline
move.l d0,d4 d4=RdArgs-struct
beq NoRA
move.l (sp),d0 SCREENMODE keyword ?
beq NoMode
move.l d0,a2
GetHex moveq #0,d0
moveq #0,d1
.A move.b (a2)+,d1 get hexadecimal number
cmp.b #"0",d1
blo.s .B
cmp.b #"9",d1
bls.s .C
bset #5,d1
cmp.b #"a",d1
blo.s .B
cmp.b #"f",d1
bhi.s .B
sub.b #"a"-10-"0",d1
.C sub.b #"0",d1
lsl.l #4,d0
or.b d1,d0
bra.s .A
.B lea NewMoni(pc),a0
move.l d0,(a0)
beq NoMon
and.l #MONITOR_ID_MASK,d0
sub.l a1,a1
move.l d7,a6
CALL OpenMonitor
lea MonSpec(pc),a0
move.l d0,(a0)
beq NoMon
move.l d0,a1
move.l ms_LegalView+0(a1),4(a0)
GetMoni move.l d6,a6
CALL Forbid
move.l d7,a1 patch MakeVPort
move.l #_LVOMakeVPort,d0
lea Patch(pc),a0
exg.l d0,a0
CALL SetFunction
lea OldFunc(pc),a0
move.l d0,(a0)
beq.s NoSet
CALL CacheClearU self modifying code :-)
CALL Permit
Install tst.l 4(sp) INSTALL keyword ?
beq.s WaitC
sub.l a1,a1
CALL FindTask
move.l d0,a0
move.l pr_CLI(a0),d0
beq.s WaitC
lsl.l #2,d0
move.l d0,a0
clr.l cli_Module(a0) do not free seglist
bra.s NoMode
WaitC moveq #0,d0
moveq #0,d1
bset #12,d1
CALL SetSignal
moveq #0,d0
bset #12,d0
CALL Wait wait for CTRL-C
CALL Forbid
move.l d7,a1 unpatch MakeVPort
move.l #_LVOMakeVPort,a0
move.l OldFunc(pc),d0
CALL SetFunction
lea Patch(pc),a0
cmp.l a0,d0
beq.s Removed
move.l d7,a1 something else has patched it
move.l #_LVOMakeVPort,a0
CALL SetFunction reset newer func
CALL Permit
bra.s WaitC and wait some more
Removed CALL CacheClearU
CALL Permit
NoSet move.l MonSpec(pc),a0 free stuff
move.l d7,a6
CALL CloseMonitor
NoMon
NoMode move.l d5,a6
move.l d4,d1
CALL FreeArgs free RdArgs-struct
NoRA move.l d7,a1
move.l d6,a6
CALL CloseLibrary close gfx
NoGfx move.l d5,a1
move.l d6,a6
CALL CloseLibrary close dos
NoDos addq.l #8,sp
moveq #0,d0
rts
;--------------------------------------------------------------
Patch: movem.l d0-d1/a0-a4,-(sp)
move.l a0,a3 a3=View
move.l a1,a2 a2=ViewPort
CALL GfxLookUp
move.l d0,a4 a4=ViewExtra (found)
tst.l d0
bne.s VEfnd
moveq #VIEW_EXTRA_TYPE,d0
CALL GfxNew
move.l d0,a4 a4=ViewExtra (created)
tst.l d0
beq.s NoPtch
move.l d0,a1
move.l a3,a0
CALL GfxAssociate
bra.s VEcrt
VEfnd move.l a2,a1 only patch ColorMap, if ViewExtra was found
move.l vp_ColorMap(a2),d0
beq.s NoPtch
move.l d0,a2
tst.b cm_Type(a2)
beq.s NoPtch
move.l a1,cm_vp(a2)
move.l MonSpec(pc),d0
cmp.l ve_Monitor(a4),d0 check if right monitor present
beq.s NoPtch
move.l cm_VPModeID(a2),d0
and.l #MONITOR_ID_MASK,d0 check for default monitor
beq.s VEcrt
move.l NewMoni(pc),d0
move.l d0,cm_VPModeID(a2)
move.w d0,vp_Modes(a1)
CALL FindDisplayInfo
move.l d0,cm_NormalDisplayInfo(a2)
move.l d0,cm_CoerceDisplayInfo(a2)
VEcrt move.l a3,ve_View(a4)
lea MonSpec(pc),a0
move.l (a0),ve_Monitor(a4)
move.w 4(a0),v_DxOffset(a3)
move.w 6(a0),v_DyOffset(a3)
or.w #V_EXTENDED_MODE,v_Modes(a3)
NoPtch movem.l (sp)+,d0-d1/a0-a4
dc.w $4ef9 jump to old jumpin
OldFunc dc.l 0
NewMoni dc.l 0 Global variables
MonSpec dc.l 0
Voffset dc.w 0,0
;--------------------------------------------------------------
dosname dc.b "dos.library",0
gfxname dc.b "graphics.library",0
Template dc.b "SCREENMODE/A,INSTALL/S",0
version dc.b "$VER: PromoteView 2.0 (7-Jun-96)",10,0